package org.misty.redis.web.config;

import lombok.Setter;
import org.misty.redis.bloomfilter.BloomFilter;
import org.misty.redis.bloomfilter.BloomFilterConfig;
import org.misty.redis.client.JedisPoolAdapter;
import org.misty.redis.client.RedisTemplateAdapter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "bloom.filter")
public class BloomFilterConfigurer {
    @Setter
    private BloomFilterConfig test;

    @Setter
    private BloomFilterConfig test2;

    @Setter
    private BloomFilterConfig test3;

    @Setter
    private BloomFilterConfig user;

    @Bean
    public BloomFilter testFilter(RedisTemplateAdapter client) {
        return new BloomFilter(client, test);
    }

    @Bean
    public BloomFilter test2Filter(JedisPoolAdapter client) {
        return new BloomFilter(client, test2);
    }

    @Bean
    public BloomFilter test3Filter(JedisPoolAdapter client) {
        return new BloomFilter(client, test3);
    }

    @Bean
    public BloomFilter userFilter(JedisPoolAdapter client) {
        return new BloomFilter(client, user);
    }
}
